from rest_framework import serializers

from car.models import Record


class RecordSerializer(serializers.ModelSerializer):
    makedate = serializers.SerializerMethodField()

    @staticmethod
    def get_makedate(record):
        return record.makedate.strftime('%Y-%m-%d %H:%M')

    class Meta:
        model = Record
        fields = '__all__'
